import React, {useEffect, useState} from "react";
import {Table} from "antd";
import {getManagerUserInfoWithConditions} from "../../../api/userApi";


function UserManageData(){

    const col = [
        {
            title: '功能列',
            dataIndex: 'panel',
            key: 'panel'
        },
        {
            title: '行政区域',
            dataIndex: 'districtName',
            key: 'districtName'
        },
        {
            title: '所属单位名称',
            dataIndex: 'orgName',
            key: 'orgName'
        },
        {
            title: '状态',
            dataIndex: 'status',
            key: 'status'
        },
        {
            title: '姓名',
            dataIndex: 'realName',
            key: 'realName'
        },
        {
            title: '用户名',
            dataIndex: 'username',
            key: 'username'
        },
        {
            title: '联系电话',
            dataIndex: 'mobile',
            key: 'mobile'
        },
        {
            title: '角色',
            dataIndex: 'roles',
            key: 'roles'
        }
    ]

    const [data, setData] = useState([])

    const getData = () => {
        getManagerUserInfoWithConditions()
            .then(res => {
                setData(res)
            })
    }

    useEffect(() => {
        getData()
    }, []);


    return(
        <div>
            <Table dataSource={data} columns={col}/>
        </div>
    )
}

export default UserManageData